home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: uu4news.netcom.com!friend!news
- From: rich@kastle.com (Richard Krehbiel)
- Subject: Pondering cpp... (was: Override a cpp macro?)
- Message-ID: <1996Jan11.134602.1234@friend.kastle.com>
- Sender: news@friend.kastle.com (News)
- Reply-To: rich@kastle.com
- Organization: Kastle Development Associates
- X-Newsreader: Forte Free Agent 1.0.82
- References: <4d0v5r$6fs@oak78.doc.ic.ac.uk> <TANMOY.96Jan10131159@qcd.lanl.gov>
- Date: Thu, 11 Jan 1996 13:48:56 GMT
-
- tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
-
- >--text follows this line--
- >In article <4d0v5r$6fs@oak78.doc.ic.ac.uk> rwmj@doc.ic.ac.uk (Richard
- >Jones) writes:
-
- > I'm trying to redefine a cpp macro, but using the old definition. I've got
- > a macro defined:
- >
- > [...]
- >
- >Unfortunately, the C preprocessor has very limited capabilities. No,
- >it is not an obvious thing to want to do in a C preprocessor.
-
- You know, I've quite often wished for a more powerful macro processor.
- Some Unix versions of cc have a option to pass the C source through
- the m4 macro processor instead of cpp, and while m4 is a far more
- powerful macro language, it's also very difficult to use and not at
- all compatible; cpp macros aren't m4 macros.
-
- (BTW not that this helps, but m4 can do what the original poster was
- asking.)
-
- Perhaps I could write a cpp-to-m4 translator. Then I'd pass my
- source, including anyone's headers, through the translator first, then
- through m4, then into the compiler. Then I can use a of mix cpp and
- m4 macros. Easier would be simply passing the source through cpp
- first, then m4, but then I wouldn't be able to use cpp #defines in m4
- macros or vice versa.
-
- I've pondered writing an enhanced cpp (probably by extending GNU cpp)
- that has multiple-line macros that may contain pp commands, iteration,
- arithmetic, powerful string expressions, etc.
-
- But then, I'd have a new language that no one else uses, and likely no
- one else would want to. Nobody likes new translation steps. And
- integrated Windows development environments are typically unable to
- support unusual source file types (first hand experience here; I have
- a Windows project with a YACC component that I always have to process
- by hand).
-
- Sigh.
-
- --
- Richard Krehbiel, Kastle Systems, Arlington VA USA
- rich@kastle.com (work) or richk@cais.com (personal)
-
-